package app16;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;

public class PrintWriterDemo1{
    public static void main(String[] args){
        Path path=Paths.get("C:\\Users\\yangxiaopang\\Desktop\\py4e\\ex_02_03\\code3\\Origin.py");
        Charset usAsciiCharset=Charset.forName("US-ASCII");
        try(BufferedWriter bufferedWriter=
                    Files.newBufferedWriter(path,usAsciiCharset,
                            StandardOpenOption.CREATE);
            PrintWriter printWriter=
                    new PrintWriter(bufferedWriter)){
            printWriter.println("PrintWriter is easy to use.");
            printWriter.println(1234);
        }catch(IOException e){
            e.printStackTrace();
        }
    }
}
